int finalPositionOfSnake(int n, char** commands, int commandsSize)
{
    int row = 0, column = 0;
    for (int i = 0; i < commandsSize; i++) {
        char c = commands[i][0];
        if (c == 'U') {
            row--;
        } else if (c == 'R') {
            column++;
        } else if (c == 'D') {
            row++;
        } else if (c == 'L') {
            column--;
        }
    }
    return row * n + column;
}